package com.jinzhi.api.config;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jinzhi.jzweb.domain.KawmTypeDO;
import com.jinzhi.jzweb.service.KawmTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.ui.Model;

@ControllerAdvice
public class GlobalControllerAdvice {
    @Autowired
    private KawmTypeService kawmTypeService;
    @ModelAttribute
    public void addAttributes(Model model) {
       KawmTypeDO kawmTypeDO= kawmTypeService.selectOne((new EntityWrapper<KawmTypeDO>()).eq("specific_type","501"));
       model.addAttribute("themeValue",(null!=kawmTypeDO && ""!=kawmTypeDO.getValue())? kawmTypeDO.getValue():'1');
    }
}
